<?
include "../inc-config.php";
?>
<title>Viewing Profile</title>
<?php
print "<link rel='stylesheet' href='admin/style.css' type='text/css'>";
$userID=$_GET['userID'];
$getuserinfo="SELECT * from b_users a, b_templates b where b.templateid=a.templateclass and a.userID='$userID'";
$getuserinfo2=mysql_query($getuserinfo) or die("Could not get user info");
$getuserinfo3=mysql_fetch_array($getuserinfo2);
$user=$getuserinfo3[username];
print "<table class='maintable'>";

if ($getuserinfo3[ranktitle]<>"No Rank") {
print "<tr class='regrow'><td><A href='index.php'>Forum Home</a> >> User Profiles - $getuserinfo3[ranktitle] $getuserinfo3[username]</td></tr>";
print "</table><br><br><br>";
print "<table class='maintable' align='center' width='400px'>";
print "<tr class='headline'><td colspan='2'><center>User Profile for $getuserinfo3[ranktitle] $getuserinfo3[username]</center></td></tr>";
} else {
print "<tr class='regrow'><td><A href='index.php'>Forum Home</a> >> User Profiles - $getuserinfo3[username]</td></tr>";
print "</table><br><br><br>";
print "<table class='maintable' align='center' width='400px'>";
print "<tr class='headline'><td colspan='2'><center>User Profile for $getuserinfo3[username]</center></td></tr>";}
if($getuserinfo3[showprofile]==0)
{
  print "<tr class='forumrow'><td colspan='2'><center>This user has opted to not show their profile.</center></td></tr>";
}
else
{
  print "<tr class='forumrow'><td>Username:</td><td>$getuserinfo3[username]</td></tr>";
  print "<tr class='forumrow'><td>Rank:</td><td>$getuserinfo3[ranktitle]</td></tr>";
  print "<tr class='forumrow'><td>Posts:</td><td>$getuserinfo3[posts]</td></tr>";
  print "<tr class='forumrow'><td>Reputation:</td><td>$getuserinfo3[honours]</td></tr>";
  print "<tr class='forumrow'><td>Points:</td><td>$getuserinfo3[points]</td></tr>";
  print "<tr class='forumrow'><td>Location:</td><td>$getuserinfo3[location]</td></tr>";
  print "<tr class='forumrow'><td>AIM:</td><td>$getuserinfo3[AIM]</td></tr>";
  print "<tr class='forumrow'><td>ICQ:</td><td>$getuserinfo3[ICQ]</td></tr>";
  print "<tr class='forumrow'><td colspan='2' align='center'>";
  //*************PLAYER PHOTO**********
  if ($getuserinfo3[photo]<>"") { 
  	print "<div style='padding: 5px;margin: 7px;color:#cccccc;background-color:black; border: solid 1px #000000'>";
	$photo=htmlentities($getuserinfo3[photo]);
    print "<img style='max-width: 200px;max-height: 300px;' src='$photo'>";	
	print "</div>";
	}
  //*************CHAR INFO************
	print "<div style='padding: 5px;margin: 7px;color:#cccccc;background-color:black; border: solid 1px #000000'><div style='margin: 15px'></div>";
	$userselect="SELECT * from b_users where username='$user'";
    $userselect2=mysql_query($userselect);
    $userselect3=mysql_fetch_array($userselect2);
	$SQLwow ="SELECT * from accounts where login='$getuserinfo3[username]'";
	$SQLwow2=mysql_query($SQLwow) or die("Could not get user char info".mysql_error());
	$SQLwow3=mysql_fetch_array($SQLwow2);
	$SQLawow ="SELECT * from characters where acct='$SQLwow3[acct]' and guid='$getuserinfo3[charid]'";
	$SQLawow2=mysql_query($SQLawow) or die("Could not get user char info");
	$SQLawow3=mysql_fetch_array($SQLawow2);
	$all ="SELECT * from characters where acct='$SQLwow3[acct]' order by name";
	$all2=mysql_query($all) or die("Could not get user char info");

	if ($getuserinfo3[avatar]=="")
	    {
		  if ($getuserinfo3[charid]=="0") {
		  print "<div style='height: $avatarheight;'>[No Avatar]</div>";} else {

		  if ($SQLawow3[level]<="50")
						 {
							print "<img style='border:solid 1px #000000' src='".$boardpath."avatars/wow-default/$SQLawow3[gender]-$SQLawow3[race]-$SQLawow3[class].gif' height='$avatarheight' width='$avatarwidth' border='0' class='avatar'>";
						 }
						elseif ($SQLawow3[level]>="51" && $SQLawow3[level]<="69" )
						 {
						   print "<img style='border:solid 1px #000000' src='".$boardpath."avatars/wow/$SQLawow3[gender]-$SQLawow3[race]-$SQLawow3[class].gif' height='$avatarheight' width='$avatarwidth' border='0' class='avatar'>";
						 }
						 else {
								   print "<div align='center'><img style='border:solid 1px #000000' src='".$boardpath."avatars/wow-70/$SQLawow3[gender]-$SQLawow3[race]-$SQLawow3[class].gif' height='$avatarheight' width='$avatarwidth' border='0' class='avatar'></div>";
						 }
		   }
		} else
		{ print "<img style='border: solid 1px #000000;' src='$userselect3[avatar]' height='$avatarheight' width='$avatarwidth' border='0' class='avatar'>";}
	print "<br><br>";
	if ($getuserinfo3[charid]=="0")
	           {print "[No character selected]<br><br>";}
	else       {if ($SQLawow3[race]=="1" || $SQLawow3[race]=="3" || $SQLawow3[race]=="4" || $SQLawow3[race]=="7" || $SQLawow3[race]=="11")
					 { $side="0"; } else {$side="1";}
				print "<strong>$SQLawow3[name]</strong> Level $SQLawow3[level]<br><br><img src='images/pvpranks/rank_default_$side.gif' title='Side' /> <img src='images/race/$SQLawow3[race]-$SQLawow3[gender].gif' title='Race' />&nbsp;&nbsp;<img src='images/class/$SQLawow3[class].gif' title='Class' />&nbsp;&nbsp;<img src='images/pvpranks/rank$SQLawow3[pvprank].gif' title='Rank' />";
				$gold=substr($SQLawow3[gold], 0, -4); if ($gold=='') {$gold="0";}
				$silver=substr($SQLawow3[gold], 0, -2); $silver2=substr($silver, -2); if ($silver2=='') {$silver2="0";}
				$copper=substr($SQLawow3[gold], -2); if ($copper=='') {$copper="0";}
				print "<BR><br>Money: $gold <img src='images/pvpranks/money_gold.gif' />&nbsp;&nbsp;$silver2 <img src='images/pvpranks/money_silver.gif' />&nbsp;&nbsp;$copper <img src='images/pvpranks/money_copper.gif' /><div style='margin:6px'></div>";
				}
	print "<br>All characters:<br>";
	print "<table width='200' border='0' style='color:white;font-size:12px'>";
	while ($all3=mysql_fetch_array($all2)){
		 print "<tr><td align='left'>$all3[name]</td><td align='center'>$all3[level]</td>";
		 print "<td align='left'><img src='images/race/$all3[race]-$all3[gender].gif' title='Race' />&nbsp;&nbsp;";
		 print "<img src='images/class/$all3[class].gif' title='Class' />&nbsp;&nbsp;</td>";
		 print "<td align='left'><img src='images/pvpranks/rank$all3[pvprank].gif' title='Rank' /></td></tr>";
		}
	print "</table><br><br><br><a href='pm/writepm.php?userID=$getuserinfo3[userID]'>SEND PM</a>";
    print "</div>";

	//*****************************************

  print "</td></tr>";

}
print "</table>";
?>
</td></tr></table>

